package top.fangw.tenant.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import top.fangw.common.mybatis.annotation.DyDataSource;
import top.fangw.tenant.pojo.entity.Oauth2RegisteredClient;
import top.fangw.tenant.mapper.Oauth2RegisteredClientMapper;
import top.fangw.tenant.service.IOauth2RegisteredClientService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author fangw
 * @since 2024-02-22
 */
@Service
public class Oauth2RegisteredClientServiceImpl extends ServiceImpl<Oauth2RegisteredClientMapper, Oauth2RegisteredClient> implements IOauth2RegisteredClientService {

    @Override
    @DyDataSource
    public Oauth2RegisteredClient geyByClientId(String clientId) {
        Oauth2RegisteredClient oauth2RegisteredClient = this.baseMapper.selectOne(new LambdaQueryWrapper<>(Oauth2RegisteredClient.class).eq(Oauth2RegisteredClient::getClientId, clientId));
        return oauth2RegisteredClient;
    }
}
